SortInPlace Generic Method

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
public static void SortInPlace<T>(
	IList<T> list,
	Comparison<T> comparison
)
Visual Basic (Declaration)
Public Shared Sub SortInPlace(Of T) ( _
	list As IList(Of T), _
	comparison As Comparison(Of T) _
)
Visual C++
public:
generic<typename T>
static void SortInPlace (
	IList<T>^ list, 
	Comparison<T>^ comparison
)

Parameters

list
IList<(Of <T>)>
The list or array to sort.
comparison
Comparison<(Of <T>)>
The comparison delegate used to compare items in the collection.

Type Parameters

T

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also